package ejb.dao;



import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import ejb.entity.Role;


@Stateless
public class DefaultRoleDAO implements RoleDAO{
	@PersistenceContext
	EntityManager em;	
	
    public DefaultRoleDAO() { }    

    @Override
	public Role create(Role role){
    	try{
    		em.persist(role);
    	}catch(IllegalArgumentException e){
    		return null;
    	}
    	return role;    
    }
	
}
